/*
 * @Author: maomao
 * @Date: 2021-03-29 12:37:40
 * @Description: 
 * @FilePath: \client-app\src\main.ts
 */
import { createApp } from "vue";
import router from "./router";
import App from './App.vue';
import appInfo from "./app-info";
import 'devextreme/dist/css/dx.common.css';
import './themes/generated/replace.scss';
import './themes/generated/global.scss';
import 'element-plus/packages/theme-chalk/src/base.scss'
import Validate from "@/utils/validate"
import { Auth } from "@/utils/auth"
import linkimg from "@/components/linkimg.vue"
const isApp = function isApp(globalOb) {
  return globalOb.WPFAuth != undefined
}
let globalObject = window as any;
globalObject.labValidate = new Validate()
globalObject.Auth = Auth
if (isApp(globalObject)) {
  globalObject.WPFAuth.getToken().then(token => {
    Auth.saveToken(token)
  });
} else {
  let token = Auth.getTokenByUrl()
  if (token) {
    Auth.saveToken(token)
  }
}
const app = createApp(App);
app.config.globalProperties.$appInfo = appInfo;
app.config.warnHandler = function(msg, vm, trace) {
  return false;
}
app.component("linkimg", linkimg)
app.use(router).mount('#app');